/*
 * #%L
 * java model
 * %%
 * Copyright (C) 2009 - 2011 prefabware.com Stefan Isele
 * %%
 * All Rights Reserved.
 * This program is dual-licensed under the GNU General Public license
 * or a commercial license.
 * You may select to use one or the other of these licenses.
 * To obtain a commercial license please contact Stefan Isele at www.stefan-isele.de
 * Any modifications to this file must keep this entire header intact.
 * Redistribution, except as permitted by the selected license, is prohibited.
 * #L%
 */
package com.prefabware.jmodel.typefactory;

import com.prefabware.commons.QualifiedName;
import com.prefabware.jmodel.JInterface;
import com.prefabware.jmodel.JType;
import com.prefabware.jmodel.JTypeDeclaration;

public class JInterfaceTypeFactoryDelegee extends JClassTypeFactoryDelegee {
	public class JInterfaceClassVisitor extends JTypeClassVisitor {

		public JInterfaceClassVisitor(TypeFactory typeFactory, JType[] typeArguments) {
			super(typeFactory,typeArguments);
		}

		@Override
		protected JType newJType(QualifiedName qualifiedName, JTypeDeclaration declaration, JType... typeArguments) {
		return JInterfaceTypeFactoryDelegee.this.newJType(qualifiedName, declaration, typeArguments);
		}

	}

	protected JInterfaceTypeFactoryDelegee() {
		super();
	}

	@SuppressWarnings("unchecked")
	@Override
	public <TYPE extends JType> TYPE newJType(QualifiedName qualifiedName, JTypeDeclaration declaration,
			JType... typeArguments) {
		return (TYPE) new JInterface(qualifiedName, declaration);
	}

	@Override
	public boolean acceptType(Class<? extends JType> typeClass, QualifiedName qualifiedName) {
		return typeClass.equals(JInterface.class);
	}

	@Override
	public void initialize(TypeFactory typeFactory) {
		super.initialize(typeFactory);
	}

	@Override
	public JTypeClassVisitor getVisitor(JType... typeArguments) {
		return new JInterfaceClassVisitor(typeFactory,typeArguments);
	}

}
